<#import "/admin/_layout.html" as layout>
<@layout.header "用户"></@layout.header>
<@layout.body>
    <div class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-left">
                        <li class="breadcrumb-item"><a href="#">用户</a></li>
                        <li class="breadcrumb-item active">新增</li>
                    </ol>
                </div>
            </div>
        </div>
    </div>
    <section class="content">
        <div class="container-fluid">
            <div class="card card-default">
                <form id="myForm" method="POST" action="/admin/user/doSave" ok="/admin/user/list">
                    <input type="hidden" name="source" value="admin_create">
                    <div class="card-body">
                        <div class="form-group">
                            <label for="loginAccount">登录账号</label>
                            <input type="text" name="loginAccount" class="form-control" id="loginAccount" placeholder="请输入登录账号">
                        </div>
                        <div class="form-group">
                            <label for="nickName">昵称</label>
                            <input type="text" name="nickName" class="form-control" id="nickName" placeholder="请输入昵称">
                        </div>
                        <div class="form-group">
                            <label for="password">密码</label>
                            <input type="password" name="password" class="form-control" id="password" placeholder="请输入密码">
                        </div>
                        <div class="form-group">
                            <label for="confirm_password">确认密码</label>
                            <input type="password" name="confirm_password" class="form-control" id="confirm_password" placeholder="请再次输入密码">
                        </div>
                        <div class="form-group">
                            <label for="status_sel">状态</label>
                            <select class="form-control" id="status" name="status">
                                <option value="1">启用</option>
                                <option value="0">停用</option>
                            </select>
                        </div>
                    </div>
                    <div class="card-footer">
                        <button type="submit" class="btn btn-primary">提交</button>
                    </div>
                </form>
            </div>
        </div>
    </section>
</@layout.body>
<@layout.script>
    <script>
        $(function () {
            submitForm({
                loginAccount: { required: true},
                nickName: { required: true},
                password: { required: true, minlength: 6 },
                confirm_password: { required: true, minlength: 5 },
            }, {
                password: {required: "请输入密码", minlength: "密码不能少于6位" },
                confirm_password: {required: "请再次输入密码", minlength: "密码不能少于6位" },
            })
        });
    </script>
</@layout.script>